#ifndef _UIVIEWCONTROLLER_H_
#define _UIVIEWCONTROLLER_H_

#include <QMetaType>

#include <UIKit/UIDevice.h>

typedef enum {
    UIInterfaceOrientationPortrait           = UIDeviceOrientationPortrait,
    UIInterfaceOrientationPortraitUpsideDown = UIDeviceOrientationPortraitUpsideDown,
    UIInterfaceOrientationLandscapeLeft      = UIDeviceOrientationLandscapeLeft,
    UIInterfaceOrientationLandscapeRight     = UIDeviceOrientationLandscapeRight
} UIInterfaceOrientation;
Q_DECLARE_METATYPE(UIInterfaceOrientation)

#define UIInterfaceOrientationIsLandscape(orientation)         \
   ((orientation) == UIInterfaceOrientationLandscapeLeft ||    \
    (orientation) == UIInterfaceOrientationLandscapeRight)

#define UIInterfaceOrientationIsPortrait(orientation)          \
   ((orientation) == UIInterfaceOrientationPortrait ||         \
    (orientation) == UIInterfaceOrientationPortraitUpsideDown)

class UIViewControllerPrivate;
class UIViewController : public QObject {
    Q_OBJECT

    public:
        UIViewController (QObject *parent = 0);
        ~UIViewController();

        UIInterfaceOrientation interfaceOrientation (void) const;

    protected:
        virtual void viewDidLoad (void);
        virtual void viewDidUnload (void);
        virtual void orientationChanged (void);
        virtual bool shouldAutorotate (UIInterfaceOrientation orientation) const;

    private Q_SLOTS:
        void orientationChanged (UIDeviceOrientation orientation);
        void initObjects (void);

    private:
        UIViewControllerPrivate *d;
};

#endif /* !_UIVIEWCONTROLLER_H_ */

